#include <iostream>

using namespace std;

void fun_template_test(void);

template <typename T>
void swap_xx(T &x, T &y);

int main(int argc, char const *argv[])
{
    /* code */
    fun_template_test();
    return 0;
}

void fun_template_test()
{
    int x = 1, y = 2;
    double m = 3.4, n = 2.5;

    cout << "before swap(int): x = " << x << ", y = " << y << endl;
    swap_xx(x, y);
    cout << "after swap(int): x = " << x << ", y = " << y << endl;

    cout << "before swap(double): m = " << m << ", n = " << n << endl;
    swap_xx(m, n);
    cout << "after swap(double): m = " << m << ", n = " << n << endl;
    return;
}

template <typename T>
void swap_xx(T &x, T &y)
{
    T temp = x;
    x = y;
    y = temp;
}